<?php
/**
 *
 * Application for the function: About Us
 *
 * This page will display the information about all of our dealerships.
 *
 *
 * @author Chi Zhang
 * @version 1.0
 * @package dummy-auto
 *
 */

include('../config.inc');
require('dummy-app.inc');


$dlrshp = "select * from Dealer_Info;";

$sql_list_1 = mysql_query($dlrshp);
$num_rows_1 = mysql_num_rows($sql_list_1);


if (! $num_rows_1) {
        $tree = make_app("About Us :: Error!!!");
        $app = $tree->app;
        $app->addChild('p', "Error: Dealership information not found!");
} else {
        $tree = make_app("About Us");
        $app = $tree->app;
        $app->addChild('h2', "Dealership Information:");

        $tmp = array("Name:", "Address:", "Phone Number:", "Manager:");

        for ($i=0; $i < $num_rows_1; $i++)
        {
                $row = mysql_fetch_array($sql_list_1);

                $app->addChild('table');
                for ($j=0; $j < 4; $j++)
                {
                        $app->table[$i]->addChild('tr');
                        $app->table[$i]->tr[$j]->addChild('td', $tmp[$j]);
                        $app->table[$i]->tr[$j]->addChild('td', $row[$j]);
                }
        }
}

echo $tree->asXML();
?>
